/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package BuktiTransaksi;

import java.util.ArrayList;
import java.util.List;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author Yudi
 */
public class buktiTabelModel extends AbstractTableModel {

    private List<BuktiTransaksi> buktiTrans = new ArrayList<BuktiTransaksi>();

    public buktiTabelModel(List<BuktiTransaksi> buktiList) {
        this.buktiTrans = buktiList;
    }

    @Override
    public int getRowCount() {
        return buktiTrans.size();
    }

    @Override
    public int getColumnCount() {
        return 5;
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        BuktiTransaksi bukti = buktiTrans.get(rowIndex);

        switch (columnIndex) {
            case 0:
                return BuktiTransaksi.getNo_transaksi_penj();
            case 1:
                return bukti.getWaktu().substring(0, 10);
            case 2:
                return bukti.getNoHP();
            case 3:
                return bukti.getNominal();
            case 4:
                return bukti.getHarga_penjualan();
            default:
                return "";
        }
    }

    @Override
    public String getColumnName(int column) {
        switch (column) {
            case 0:
                return "No Transaksi";
            case 1:
                return "Waktu";
            case 2:
                return "Nomor";
            case 3:
                return "Nominal";
            case 4:
                return "Harga";
            default:
                return "";
        }
    }
}
